#define Version3
using System;

internal struct SomeValueType : IComparable {
   private Int32 m_x;
   public SomeValueType(Int32 x) { m_x = x; }

#if Version1
   public Int32 CompareTo(Object other) {
      return (m_x - ((SomeValueType)other).m_x);
   }
#else
   public Int32 CompareTo(SomeValueType other) {
      return (m_x - other.m_x);
   }

   // NOTE: No public/private used on the next line
   Int32 IComparable.CompareTo(Object other) {
      return CompareTo((SomeValueType)other);
   }
#endif
}


public static class Program {
#if Version1
   public static void Main() {
      SomeValueType v = new SomeValueType(0);
      Object o = new Object();
      Int32 n = v.CompareTo(v);  // Undesired boxing
      n = v.CompareTo(o);        // InvalidCastException
   }
#endif

#if Version2
   public static void Main() {
      SomeValueType v = new SomeValueType(0);
      Object o = new Object();
      Int32  n = v.CompareTo(v); // No boxing
      n = v.CompareTo(o);        // compile-time error 
   }
#endif

#if Version3
   public static void Main() {
      SomeValueType v = new SomeValueType(0);
      IComparable c = v;          // Boxing!

      Object o = new Object();
      Int32 n = c.CompareTo(v);         // Undesired boxing
      n = c.CompareTo(o);   // InvalidCastException
   }
#endif
}